package com.zh.listener;

import com.zh.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * 初始化管理员
 */
@Component
public class CreateAdminListener implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private ILoginService loginService;

    /**
     *
     * @param event
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        loginService.createAdmin();
    }
}